package cn.rmc.hrm.fallbackmethod;

import cn.rmc.hrm.domain.Login;
import cn.rmc.hrm.feign.LoginFeign;
import cn.rmc.hrm.to.LoginMealTo;
import cn.rmc.hrm.util.AjaxResult;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

@Component
public class LoginFallBackFactroy implements FallbackFactory<LoginFeign> {
    @Override
    public LoginFeign create(Throwable throwable) {
        return new LoginFeign() {
            @Override
            public AjaxResult save(Login login) {
                throwable.printStackTrace();
                return AjaxResult.me().setSuccess(false).setMessage("保存用户信息错误");
            }

            @Override
            public AjaxResult saveLoginMeal(LoginMealTo mealTo) {
                throwable.printStackTrace();
                return AjaxResult.me().setSuccess(false).setMessage("保存登录用户信息错误");
            }
        };
    }
}
